package com.ds.lens.data.service.dao.entity;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>LensExternalEvent实体类</p>
 * <p>
 * Database Table Remarks:
 * 运维事件执行策略表
 * <p>
 * Date:2020-04-10
 *
 * @author WeiShaoying
 * @since 1.0.0
 */

@Data
public class LensExternalEvent implements Serializable {
    /**
     * fixed serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    private Long id;

    /**
     * 监控ID
     */
    private Long monitorId;

    /**
     * 监控版本
     */
    private Integer version;

    /**
     * 外部事件类型
     */
    private String externalEventType;

    /**
     * 事件时间
     */
    private Date startTime;

    /**
     * 完成时间
     */
    private Date endTime;

    /**
     * 闭合状态（0：未闭合，1：自动闭合，2：事件闭合 ）
     */
    private Integer status;

    /**
     * 超时提醒次数
     */
    private Integer reminders;

    /**
     * 最后超时提醒时间
     */
    private Date lastReminderTime;

    /**
     * 创建时间
     */
    private Date createdTime;


    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof LensExternalEvent)) {
            return false;
        }
        LensExternalEvent that = (LensExternalEvent) obj;
        return Objects.equal(id, that.id) &&
                Objects.equal(monitorId, that.monitorId) &&
                Objects.equal(version, that.version) &&
                Objects.equal(externalEventType, that.externalEventType) &&
                Objects.equal(startTime, that.startTime) &&
                Objects.equal(endTime, that.endTime) &&
                Objects.equal(status, that.status) &&
                Objects.equal(reminders, that.reminders) &&
                Objects.equal(lastReminderTime, that.lastReminderTime) &&
                Objects.equal(createdTime, that.createdTime);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id, monitorId, version, externalEventType, startTime, endTime, status, reminders, lastReminderTime, createdTime);
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("id", id)
                .add("monitorId", monitorId)
                .add("version", version)
                .add("externalEventType", externalEventType)
                .add("startTime", startTime)
                .add("endTime", endTime)
                .add("status", status)
                .add("reminders", reminders)
                .add("lastReminderTime", lastReminderTime)
                .add("createdTime", createdTime)
                .toString();
    }
}
